package com.example.rwq_test.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.rwq_test.anno.customAnno.ControllerAround;
import com.example.rwq_test.bean.LogBack;
import com.example.rwq_test.service.LogBackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("logback")
@RestController
public class LogBackController {
    private Logger logger = LoggerFactory.getLogger(LogBackController.class);

    @Autowired
    private LogBackService logBackServicel;

    @ControllerAround
    @GetMapping("getLog")
    public LogBack getLog(@RequestParam(value = "vin") String vin){
        logger.info("receiver getLog message...");
        return new LogBack(1, "getLog", "getLog 1");
    }

    @ControllerAround
    @PostMapping("sendLog")
    public LogBack sendLog(@RequestBody JSONObject request){
        logger.info("receiver getLog message...");
        return new LogBack(1, "getLog", "getLog 1");
    }

    @ControllerAround
    @PostMapping("sendLog1")
    public void sendLog1(@RequestBody JSONObject request){
        logger.info("receiver getLog message...");
    }
}
